/*****************************

Replication file for
Egan, Konisky, Mullin. "Ascendant public opinion: The rising influence of climate change on Americansí attitudes about the environment." Public Opinion Quarterly

TODAY'S DATE: August 31, 2021

This replication archive includes information to reproduce all numeric and graphical results in the article's main text and its supporting material, except where restricted by a data provider's terms of use.

Datafile in the replication archive:

media.coverage.dta

	Coverage of the environment in the NYT, WaPo, and WSJ 
	(compiled by authors from Factiva on March 11, 2021)

	
Datafiles publicly available: 

CCES_Panel_Full3waves_VV_V4.dta

	Cooperative Congressional Election Study Panel (2010-2014)
	available at https://doi.org/10.7910/DVN/TOE8I1 
	(last accessed August 31, 2021)

VOTER_Survey_July17_Release1-dta.dta

	2017 VOTER Survey Full Data Set	
	available at https://www.voterstudygroup.org/data 
	(last accessed August 31, 2021)

nchscountyurbanruralcodes.dta

	National Center for Health Statistics rural-urban classification of counties
	available at https://www.cdc.gov/nchs/data_access/urban_rural.htm 
	(last accessed Nov 14 2019)

	
Datafile not included: 

"GPSS Environment Final GA Aggregate.dta"

	The Gallup Organizationís Environment Poll
	(provided directly to authors by Gallup, May 2020)
	(may not be archived per Gallup Terms of Use)
	
	
******************************/



set more off

*********************
*Figure 1
*********************

use media.coverage.dta, clear

twoway (line cc_given_env_pct year, lc(black) lw(thick))(line pollut_given_env_pct year, lc(gs7) lw(medthick) lp(solid)) (line species_given_env_pct year, lc(gs7) lw(medthick) lp(solid)) (line ozone_given_env_pct year, lc(gs7) lw(medthick) lp(solid)), legend(off cols(1)) xlabel(1984(5)2019) ylabel(0 "0%" 10 "10%" 20 "20%" 30 "30%", angle(horizontal)) ytitle("") aspect(.6) xtitle("") plotregion(lc(none)) xsize(5) ysize(3) xscale(range(1984 2024)) text(31 2022 "CLIMATE""CHANGE") text(19 2022 "POLLUTION", c(gs7)) text(11 2022 "ENDANGERED" "SPECIES", c(gs7)) text(1 2022 "OZONE" "LAYER", c(gs7))

graph export Fig1.png, width(5000) height(3000) as(png) replace


*********************
*Figure 2, Table S1, Figure S1
*********************

*** annual models predicting worry about the environment ***

use "GPSS Environment Final GA Aggregate.dta", clear

for var envworry_* worry_*: recode X (4=0)(3=.33)(2=.67)(5=.)(6=.)

svyset [pw=wtfctr]

foreach i of numlist 2001/2002 2004 2006/2008 2010/2018 {
svy: quietly reg worry_envt envworry_gw envworry_rivers envworry_extinct envworry_air envworry_drnkwater envworry_rainfst if yr==`i' 
estimates store annual`i'
gen briv`i'=_b[envworry_rivers]
gen bair`i'=_b[envworry_air]
gen brain`i'=_b[envworry_rain]
gen bgw`i'=_b[envworry_gw]
gen bdw`i'=_b[envworry_drnkwater]
gen bext`i'=_b[envworry_extinct]
gen seriv`i'=_se[envworry_rivers]
gen seair`i'=_se[envworry_air]
gen serain`i'=_se[envworry_rain]
gen segw`i'=_se[envworry_gw]
gen sedw`i'=_se[envworry_drnkwater]
gen seext`i'=_se[envworry_extinct]
}

foreach i of numlist 2000/2004 2006/2018 {
quietly alphawgt envworry_rivers envworry_extinct envworry_air envworry_drnkwater envworry_rainfst [aweight=wtfctr] if yr==`i', std
gen aicall`i'=r(rho)
}


* Table S1 *

estout annual* using TableS1.tab, cells("b(star fmt(%9.2f))" "se(par([ ]))") stats(N r2, fmt(%9.0gc %9.2f)) legend label collabels(none) style(tab) starlevels(* 0.05) replace


keep id briv2001-aicall2018
keep in 1
reshape long bgw briv bext bair bdw brain segw seriv seext seair sedw serain aicall, i(id) j(yr)
drop id
save Fig2.dta, replace

*estimate annual coefficient change (final column of Table S1):

reg bgw yr
reg briv yr
reg bext yr
reg bair yr
reg bdw yr
reg brain yr


* Figure 2 *

foreach i in riv air rain gw dw ext {
	gen `i'cilo = b`i' - 1.96*se`i'
	gen `i'cihi = b`i' + 1.96*se`i'
}


twoway (rarea gwcihi gwcilo yr, sort color(gs14)) (connected bgw yr, lc(black) lw(medthick) mcolor(black) msize(small)), xtitle("") ytitle("") legend(off) yscale(r(-.1 .3)) ylabel(-.1(.1).3, angle(horizontal) grid) xlabel(none) xscale(off) text(-.14 2018 "CLIMATE CHANGE", c(black) size(medsmall) placement(west)) plotregion(lc(none)) fxsize(115) fysize(100) scheme(s1color) saving(gwci, replace)

twoway (rarea dwcihi dwcilo yr, sort color(gs15)) (connected bdw yr, lc(gs6) mcolor(gs6) msize(vsmall)), xtitle("") ytitle("") legend(off) yscale(r(-.1 .3) off) xscale(off) ylabel(-.1(.1).3, nolabels grid) xlabel(none) text(-.14 2018 "DRINKING WATER", c(gs6) size(medsmall) placement(west)) plotregion(lc(none)) fxsize(100) fysize(100) scheme(s1color) saving(dwci, replace)

twoway (rarea rivcihi rivcilo yr, sort color(gs15)) (connected briv yr, lc(gs6) mcolor(gs6) msize(vsmall)), xtitle("") ytitle("") legend(off) yscale(r(-.1 .3) off) xscale(off) ylabel(-.1(.1).3, nolabels grid) xlabel(none) text(-.14 2018 "RIVERS, LAKES", c(gs6) size(medsmall) placement(west)) plotregion(lc(none)) fxsize(100) fysize(100) scheme(s1color) saving(rivci, replace)

twoway (rarea aircihi aircilo yr, sort color(gs15)) (connected bair yr, lc(gs6) mcolor(gs6) msize(vsmall)) , xtitle("") ytitle("") legend(off) yscale(r(-.1 .3)) ylabel(-.1(.1).3, angle(horizontal) grid) xlabel(2002(4)2018) text(-.14 2018 "AIR POLLUTION", c(gs6) size(medsmall) placement(west)) plotregion(lc(none)) fysize(110) fxsize(115) scheme(s1color) saving(airci, replace)

twoway (rarea extcihi extcilo yr, sort color(gs15)) (connected bext yr, lc(gs6) mcolor(gs6) msize(vsmall)), xtitle("") ytitle("") legend(off) yscale(r(-.1 .3) off) ylabel(-.1(.1).3, nolabels grid) xlabel(2002(4)2018) text(-.14 2018 "SPECIES EXTINCTION", c(gs6) size(medsmall) placement(west)) plotregion(lc(none)) fxsize(100) fysize(110) scheme(s1color) saving(extci, replace)

twoway (rarea raincihi raincilo yr, sort color(gs15)) (connected brain yr, lc(gs6) mcolor(gs6) msize(vsmall)), xtitle("") ytitle("") legend(off) yscale(r(-.1 .3) off) ylabel(-.1(.1).3, nolabels grid) xlabel(2002(4)2018) text(-.14 2018 "RAINFORESTS", c(gs6) size(medsmall) placement(west)) plotregion(lc(none)) fxsize(100) fysize(110) scheme(s1color) saving(rainci, replace)

graph combine gwci.gph dwci.gph rivci.gph airci.gph extci.gph rainci.gph, row(2) title("coefficients predicting environment worry", position(9) orientation(vertical) size(small)) ycommon scheme(s1color) xsize(5) ysize(3) 

graph export Fig2.png, width(5000) height(3000) as(png) replace


* Figure S1 *

twoway (connected aicall yr, lc(black) mcolor(black) msize(small)), xtitle("") ytitle("average interitem correlation" "in worry about five environmental problems") yscale(r(.3 .6)) ylabel(.3(.1).6, angle(horizontal)) scheme(s1color) 

graph export FigS1.png, width(5000) height(3500) as(png) replace


*********************
*Figure 3
*********************

*get coefficient on global warming as predictor of environmental worry:

use Fig2.dta, clear

keep yr bgw

rename yr year

*merge media coverage data:

merge 1:1 year using "media.coverage.dta", keepusing(cc_given_env_pct)

*calculate correlation:

corr bgw cc_given

sort year

*produce Figure 3:

twoway  (line cc_given_env_pct year, lc(black) lw(thick))  (connected bgw year, yaxis(2) lc(gs7) mc(black) msize(small) ms(O) mfc(white) lw(medium) lp(solid)) if year<2019 & year>2000, xlabel(2000(5)2020) aspect(.6) xtitle("") yscale(range(5 30)) ylabel(5 "5%" 10 "10%" 15 "15%" 20 "20%" 25 "25%" 30 "30%", angle(horizontal)) ytitle("news coverage", margin(vsmall)) ylabel(.1(.05).3, ax(2) angle(horizontal)) ytitle("coefficient", ax(2) margin(vsmall))text(10 2015 "{it:r }= .79", size(vlarge)) xsize(5) ysize(3) plotregion(lc(none)) xlabel(2002(4)2018) legend(on cols(1) label(2 "Coefficient on climate change as predictor of environment concern") label(1 "Share of environment stories mentioning climate change"))

graph export Fig3.png, as(png) width(5000) height(3000) replace


*********************
*Figures 4 & 5, Figure S2, Table S6
*********************

*** simulated environmental concern for all respondents plus separate analyses for Ds and Rs ***

use "GPSS Environment Final GA Aggregate.dta", clear

for var envworry_* worry_*: recode X (4=0)(3=.33)(2=.67)(5=.)(6=.)

gen yrnum = yr-2001

svyset [pw=wtfctr]

svy: reg worry_envt  c.yrnum##(c.envworry_gw c.envworry_rivers c.envworry_air c.envworry_rainfst c.envworry_drnkwater c.envworry_extinct c.worry_crime c.worry_drugs c.worry_econ c.worry_energy c.worry_hlthcare c.worry_immig c.worry_race c.worry_unemploy )

predict error if e(sample), resid
replace error = abs(error)
sum error
estadd scalar see = r(mean)
drop error

estimates store all


predict envt_hat if e(sample)

gen envt_adjust = envt_hat - (yrnum*envworry_gw*e(b)[1,16]) - (yrnum*envworry_rivers*e(b)[1,17]) - (yrnum*envworry_air*e(b)[1,18])  - (yrnum*envworry_rainfst*e(b)[1,19]) - (yrnum*envworry_drnkwater*e(b)[1,20]) - (yrnum*envworry_extinct*e(b)[1,21])

aorder

collapse (mean) worry_* envt_hat envt_adjust [pweight = wtfctr], by(yr)

ren worry_* *


twoway (rarea envt envt_adjust yr, sort fcolor(gs4) fintensity(15) lwidth(none)) (line crime yr, lw(thin) lc(gs10) lw(vthin)) (line drugs yr, lw(thin) lc(gs10) lw(vthin)) (line econ yr, lw(thin) lc(gs10) lw(vthin)) (line energy yr, lw(thin) lc(gs10) lw(vthin)) (line envt yr, lw(thin) lw(medthick) lc(black)) (line hlthcare yr, lw(thin) lc(gs10) lw(vthin)) (line immig yr, lw(thin) lc(gs10) lw(vthin)) (line race yr, lw(thin) lc(gs10) lw(vthin)) (line unemploy yr, lw(thin) lc(gs10) lw(vthin)) (line envt_adjust yr, lw(medthick) lp(dash) lc(black)), aspect(.65) xlabel(2002(4)2018) xsize(5) ysize(3.5) xtitle("") ytitle("level of concern (0-1 scale)", margin(vsmall)) ylabel(, angle(horizontal)) xscale(range(2000 2022)) text(.69 2020.5 "WORRY ABOUT" "ENVIRONMENT", c(black) size(vsmall)) text(.60 2020.5 "WORRY ABOUT" "ENVIRONMENT" "(simulated)", c(black) size(vsmall)) legend(on order(6 11 3) title("") label(6 "worry about the environment, actual") label(11 "worry about the environment," "if no increase in attention to climate change") label(3 "worry about other issues, actual") cols(1) size(small)) plotregion(lc(none)) scheme(s1color)

graph export Fig4.png, width(5000) height(3500) as(png) replace

* Figure S2 *

twoway (rarea envt envt_adjust yr, sort fcolor(gs4) fintensity(15) lwidth(none)) (line crime yr, lw(thin) lc("106 90 205") lw(vthin)) (line drugs yr, lw(thin) lc("219 112 147") lw(vthin)) (line econ yr, lw(thin) lc("32 178 170") lw(vthin)) (line energy yr, lw(thin) lc("156 39 176") lw(vthin)) (line envt yr, lw(thin) lw(medthick) lc(black)) (line hlthcare yr, lw(thin) lc("244 164 96") lw(vthin)) (line immig yr, lw(thin) lc("205 220 57") lw(vthin)) (line race yr, lw(thin) lc("255 87 34") lw(vthin)) (line unemploy yr, lw(thin) lc(gs10) lw(vthin)) (line envt_adjust yr, lw(medthick) lp(dash) lc(black)), aspect(.65) xlabel(2002(4)2018) xsize(5) ysize(3.5) xtitle("") ytitle("level of concern (0-1 scale)", margin(vsmall)) ylabel(, angle(horizontal)) xscale(range(2000 2022)) text(.69 2021 "ENVIRONMENT", c(black) size(vsmall)) text(.60 2021 "ENVIRONMENT (simulated)", c(black) size(vsmall)) text(.74 2021 "CRIME", c("106 90 205") size(vsmall)) text(.76 2021 "HEALTH CARE", size(vsmall) c("244 164 96"))  text(.67 2021 "DRUG ABUSE", size(vsmall) c("219 112 147")) text(.65 2021 "ECONOMY", size(vsmall) c("32 178 170")) text(.62 2021 "RACE RELATIONS", size(vsmall) c("255 87 34")) text(.58 2021 "IMMIGRATION", size(vsmall) c("205 220 57")) text(.5625 2021 "ENERGY", size(vsmall) c("156 39 176")) text(.54 2021 "UNEMPLOYMENT", size(vsmall) c(gs12)) legend(on order(6 11) title("{bf:Worry about the environment}", size(medium)) label(6 "actual") label(11 "if no increase in attention to climate change") cols(1)) plotregion(lc(none)) scheme(s1color)

graph export FigS2.png, width(5000) height(3500) as(png) replace


** partisan simulated concern **

use "GPSS Environment Final GA Aggregate.dta", clear

for var envworry_* worry_*: recode X (4=0)(3=.33)(2=.67)(5=.)(6=.)

gen yrnum = yr-2001

svyset [pw=wtfctr]

* REPUBLICANS

svy: reg worry_envt  c.yrnum##(c.envworry_gw c.envworry_rivers c.envworry_air c.envworry_rainfst c.envworry_drnkwater c.envworry_extinct c.worry_crime c.worry_drugs c.worry_econ c.worry_energy c.worry_hlthcare c.worry_immig c.worry_race c.worry_unemploy ) if partyr==1

predict error if e(sample), resid
replace error = abs(error)
sum error
estadd scalar see = r(mean)
drop error

estimates store reps

predict envt_hat_r if e(sample)

gen envt_adjust_r = envt_hat_r - (yrnum*envworry_gw*e(b)[1,16]) - (yrnum*envworry_rivers*e(b)[1,17]) - (yrnum*envworry_air*e(b)[1,18])  - (yrnum*envworry_rainfst*e(b)[1,19]) - (yrnum*envworry_drnkwater*e(b)[1,20]) - (yrnum*envworry_extinct*e(b)[1,21])


* DEMOCRATS

svy: reg worry_envt  c.yrnum##(c.envworry_gw c.envworry_rivers c.envworry_air c.envworry_rainfst c.envworry_drnkwater c.envworry_extinct c.worry_crime c.worry_drugs c.worry_econ c.worry_energy c.worry_hlthcare c.worry_immig c.worry_race c.worry_unemploy ) if partyr==3

predict error if e(sample), resid
replace error = abs(error)
sum error
estadd scalar see = r(mean)
estimates store dems
drop error

predict envt_hat_d if e(sample)

gen envt_adjust_d = envt_hat_d - (yrnum*envworry_gw*e(b)[1,16]) - (yrnum*envworry_rivers*e(b)[1,17]) - (yrnum*envworry_air*e(b)[1,18])  - (yrnum*envworry_rainfst*e(b)[1,19]) - (yrnum*envworry_drnkwater*e(b)[1,20]) - (yrnum*envworry_extinct*e(b)[1,21])


gen envt_adjust = envt_adjust_d 
replace envt_adjust = envt_adjust_r if partyr==1
replace envt_adjust = . if partyr==2

* Table S6 *

estout all dems reps using TableS6.tab, cells("b(star fmt(%9.3f)) se(par([ ]))") stats(N r2 see, fmt(%9.0gc %9.2f %9.2f)) legend label collabels(none) style(tab) starlevels(* 0.05) replace

aorder

collapse (mean) worry_* envt_hat* envt_adjust* [pweight = wtfctr], by(yr partyr)

ren worry_* *

* Figure 5 *

twoway (rarea envt envt_adjust yr if partyr==3, sort fcolor(gs14) lwidth(none)) (line envt yr  if partyr==3, lw(thin) lw(medthick) lc(black)) (line envt_adjust yr if partyr==3, lw(medthick) lp(dash) lc(black)) (rarea envt envt_adjust yr if partyr==1, sort fcolor(gs14) lwidth(none)) (line envt yr if partyr==1, lw(thin) lw(medthick) lc(black)) (line envt_adjust yr if partyr==1, lw(medthick) lp(dash) lc(black)) , aspect(.65) xlabel(2002(4)2018) yscale(range(.4 .9)) ylabel(.4(.1).9, angle(horizontal)) xsize(5) ysize(3.5) xtitle("") ytitle("level of concern (0-1 scale)") xscale(range(2000 2022)) text(.72 2020 "DEMOCRATS" "(simulated)", c(black) size(vsmall)) text(.82 2020 "DEMOCRATS", c(black) size(vsmall)) text(.495 2020 "REPUBLICANS" "(simulated)", c(black) size(vsmall)) text(.53 2020 "REPUBLICANS", c(black) size(vsmall)) legend(off) plotregion(lc(none)) scheme(s1color)

graph export Fig5.png, width(5000) height(3500) as(png) replace


*********************
*Table 1 & Tables S2, S3, S4, S5
*********************

*CCES Panel analyses:

use "CCES_Panel_Full3waves_VV_V4.dta", clear


*RECODE DATA

recode pid7_10 (2/3=1) (4=2) (5/7=3) (8=.), gen(pid_lean_10)
recode pid7_12 (2/3=1) (4=2) (5/7=3) (8=.), gen(pid_lean_12)
recode pid7_14 (2/3=1) (4=2) (5/7=3) (8=.), gen(pid_lean_14)

recode CC10_321 (5=0) (4=.25) (3=.5) (2=.75), gen(climate_10)
recode CC12_321 (5=0) (4=.25) (3=.5) (2=.75), gen(climate_12)
recode CC14_321 (5=0) (4=.25) (3=.5) (2=.75), gen(climate_14)

recode CC10_325 (5=0) (4=.25) (3=.5) (2=.75), gen (envjobs_10)
recode CC12_325 (6=.5) (5=0) (4=.25) (3=.5) (2=.75), gen (envjobs_12)
recode CC14_325 (6=.5) (5=0) (4=.25) (3=.5) (2=.75), gen (envjobs_14)

recode CC10_341A (8=4), gen(ideo_10)
replace ideo_10= (ideo_10-1)/6
replace ideo_10= 1 - ideo_10

recode CC14_341A (8=4), gen(ideo_14)
replace ideo_14= (ideo_14-1)/6
replace ideo_14= 1 - ideo_14

recode CC10_308a (2=.75) (5=.5) (3=.25) (4=0), gen(obama_10)
recode CC14_308a (2=.75) (5=.5) (3=.25) (4=0), gen(obama_14)

recode pew_churatd_10 (7=.), gen(attend_10)
replace attend_10 = 6-attend_10
replace attend_10 = attend_10/5

*RURALNESS OF COUNTY - MERGE WITH National Center for Health Statistics (NCHS) county classification scheme, available at https://www.cdc.gov/nchs/data_access/urban_rural.htm (accessed Nov 14 2019)

clonevar fips = countyfips_10

merge m:1 fips using "nchscountyurbanruralcodes.dta"

drop _merge

*set up a macro for demographic controls:

local controls = "gender_10 i.race_10##c.educ_10  c.birthyr_10##c.birthyr_10 educ_10 pid7_10 c.ideo_10##c.educ_10 obama_10 attend_10 i.nchsruralcode i.race_10##c.nchsruralcode"


*WEIGHTED SEEMINGLY UNRELATED REGRESSION (for Table 1 in text):

*tag complete cases on all variables:
svyset [pw=weight]
capture drop c
svy: reg envjobs_14 envjobs_10 climate_14 climate_10 `controls' if pid7_10<8
gen c = e(sample)

sureg (envjobs_14 envjobs_10 climate_10 `controls') (climate_14 climate_10 envjobs_10 `controls') if c==1 [aw=weight], corr

matrix foo = corr(e(Sigma))
local corr = foo[2,1]
estadd scalar corr_resid=  `corr'

estadd scalar chi =  `e(chi2_bp)'
matrix mymat = foo * foo
local tsig = (trace(mymat) - `e(k_eq)')*`e(N)' / 2
estadd scalar p = chiprob(1,`tsig')

lincom [envjobs_14]climate_10 - [climate_14]envjobs_10 
estadd scalar betadiff = `r(estimate)'
estadd scalar betadiffse = `r(se)'

estimates store maincces

*Analyses that appear in Supplementary Material

*NO CONTROLS [for Table S2]

*tag complete cases
svyset [pw=weight]
capture drop c
svy: reg climate_14 envjobs_10 climate_10  envjobs_14
gen c = e(sample)

sureg (envjobs_14 envjobs_10 climate_10) (climate_14 envjobs_10 climate_10) if c==1 [aw=weight], corr

matrix foo = corr(e(Sigma))
local corr = foo[2,1]
estadd scalar corr_resid=  `corr'

estadd scalar chi =  `e(chi2_bp)'
matrix mymat = foo * foo
local tsig = (trace(mymat) - `e(k_eq)')*`e(N)' / 2
estadd scalar p = chiprob(1,`tsig')

lincom [envjobs_14]climate_10 - [climate_14]envjobs_10 
estadd scalar betadiff = `r(estimate)'
estadd scalar betadiffse = `r(se)'

estimates store nocontrolscces

*ADD MORE ISSUES AS PREDICTORS AND PLACEBOS:

recode CC10_304 (2=0) (3=.5), gen(iraq_10)
recode CC14_304 (2=0) (3=.5), gen(iraq_14)

recode CC10_302 (2=.75) (3=.5) (4=.25) (5=0) (6/9=3), gen(natecon_10)
recode CC14_302 (2=.75) (3=.5) (4=.25) (5=0) (6/9=3), gen(natecon_14)

recode CC10_324 (4=1) (3=.67) (2=.33) (1=0), gen(abortion_10)
recode CC14_324 (4=1) (3=.67) (2=.33) (1=0), gen(abortion_14)

recode CC10_322_1 (2=0), gen(imm_10_1)
recode CC10_322_2 (2=1) (1=0), gen(imm_10_2)
recode CC10_322_3 (2=1) (1=0), gen(imm_10_3)
gen immigration_10 = imm_10_1+ imm_10_2+ imm_10_3
replace immigration_10 = immigration_10/3

recode CC14_322_1 (2=0), gen(imm_14_1)
recode CC14_322_2 (2=1) (1=0), gen(imm_14_2)
recode CC14_322_3 (2=1) (1=0), gen(imm_14_3)
gen immigration_14 = imm_14_1+ imm_14_2+ imm_14_3
replace immigration_14 = immigration_14/3

recode CC10_326 (2=0), gen(marriage_10)
replace marriage_10 = 1-marriage_10

recode CC14_326 (2=0), gen(marriage_14)
replace marriage_14 = 1-marriage_14

recode CC10_320 (2=0) (3=.5), gen(gun_10)
recode CC14_320 (2=0) (3=.5), gen(gun_14)

*Create macro with all additional issues:
local laggedpolicies = "iraq_10 natecon_10 abortion_10 immigration_10 marriage_10 gun_10" 

*re-run original analysis including all lagged policy preference items [for Table S6]:

sureg (envjobs_14 envjobs_10 climate_10 `laggedpolicies' `controls') (climate_14 climate_10 envjobs_10 `laggedpolicies' `controls') [aw=weight], corr

matrix foo = corr(e(Sigma))
local corr = foo[2,1]
estadd scalar corr_resid=  `corr'

estadd scalar chi =  `e(chi2_bp)'
matrix mymat = foo * foo
local tsig = (trace(mymat) - `e(k_eq)')*`e(N)' / 2
estadd scalar p = chiprob(1,`tsig')

lincom [envjobs_14]climate_10 - [climate_14]envjobs_10 
estadd scalar betadiff = `r(estimate)'
estadd scalar betadiffse = `r(se)'

estimates store allpoliciescces


*run repeated tests with placebo predictors [for Table S3]:

*tag complete cases again:
svyset [pw=weight]
capture drop c
svy: reg envjobs_14 envjobs_10 climate_14 climate_10 `controls' if pid7_10<8
gen c = e(sample)

capture drop placebo_tminus1

foreach predictor in climate iraq natecon abortion marriage immigration gun {
	capture drop placebo_tminus1
	gen placebo_tminus1 = `predictor'_10
	svy: reg envjobs_14 envjobs_10 placebo_tminus1 `controls' if c==1
	estimates store `predictor'
	}

*CCES Placebo Tests [Table S3]:

estout climate gun iraq immigration marriage natecon abortion using TableS3.tab, cells(b(star fmt(%9.2f)) se(par([ ]))) stats(N r2, fmt(%9.2gc)) collabels(none) starlevels(* 0.05)  style(tab) keep(placebo_tminus1 envjobs_10) replace




*Voter Study Group analyses:

use "VOTER_Survey_July17_Release1-dta.dta", clear



recode envwarm_baseline (2=.67) (3=.33) (4=0) (5=.), gen(gw_11)
recode envwarm_2016 (2=.67) (3=.33) (4=0) (5=.), gen(gw_16)

recode imiss_d_baseline (2=.67) (3=.33) (4=0), gen(enviro_11)
recode imiss_d_2016 (2=.67) (3=.33) (4=0), gen(enviro_16)

recode ideo5_baseline (6=3), gen(libcon_baseline)
recode obamaapp_base (5=2.5), gen(approval_baseline)
recode pew_churatd_bas (7=.), gen(attend_baseline)
recode urbancity_base (5=.), gen(ruralness_baseline)


*set up a macro for controls:

local controls = "i.gender_baseline c.educ_baseline##i.race_baseline c.birthyr_baseline##c.birthyr_baseline c.educ_baseline##c.libcon_baseline approval_baseline pid7_baseline attend_baseline i.ruralness_baseline i.race_baseline##c.ruralness_baseline"


*TABLE 1:

*tag complete cases
svyset [pw=weight_2016]
capture drop c
svy: reg enviro_16 enviro_11 gw_11 gw_16 `controls' if pid7_baseline<8
generate c = e(sample)

sureg (enviro_16 enviro_11 gw_11 `controls') (gw_16 gw_11 enviro_11 `controls') if c==1 [aw=weight_2016], corr

matrix foo = corr(e(Sigma))
local corr = foo[2,1]
estadd scalar corr_resid=  `corr'

estadd scalar chi =  `e(chi2_bp)'
matrix mymat = foo * foo
local tsig = (trace(mymat) - `e(k_eq)')*`e(N)' / 2
estadd scalar p = chiprob(1,`tsig')

lincom [enviro_16]gw_11- [gw_16]enviro_11 
estadd scalar betadiff = `r(estimate)'
estadd scalar betadiffse = `r(se)'

estimates store mainvsg

*Produce Table 1:

estout maincces mainvsg using Table1.tab, cells(b(star fmt(%9.2f)) se(par([ ]))) stats(N r2 corr_resid chi p betadiff betadiffse, fmt(%9.2fc)) collabels(none) starlevels(* 0.05)  style(tab) keep(climate_10 envjobs_10 gw_11 enviro_11) order(climate_10 gw_11) unstack replace

*Without controls [for Table S2]:

*tag complete cases:
svyset [pw=weight_2016]
capture drop c
svy: reg enviro_16 enviro_11 gw_11 gw_16
generate c = e(sample)

sureg (enviro_16 enviro_11 gw_11) (gw_16 enviro_11 gw_11) if c==1 [aw=weight_2016], corr

matrix foo = corr(e(Sigma))
local corr = foo[2,1]
estadd scalar corr_resid=  `corr'

estadd scalar chi =  `e(chi2_bp)'
matrix mymat = foo * foo
local tsig = (trace(mymat) - `e(k_eq)')*`e(N)' / 2
estadd scalar p = chiprob(1,`tsig')

lincom [enviro_16]gw_11 - [gw_16]enviro_11
estadd scalar betadiff = `r(estimate)'
estadd scalar betadiffse = `r(se)'

estimates store nocontrolsvsg

*Produce Table S2:

estout nocontrolscces nocontrolsvsg using TableS2.tab, cells(b(star fmt(%9.2f)) se(par([ ]))) stats(N r2 corr_resid chi p betadiff betadiffse, fmt(%9.2fc)) collabels(none) starlevels(* 0.05)  style(tab) keep(climate_10 envjobs_10 gw_11 enviro_11) order(envjobs_10 climate_10 enviro_11 gw_11) unstack replace


*ADDITIONAL ISSUES AS PREDICTORS AND PLACEBOS

recode healthreformbill_baseline (2=.5) (3=0) (8=.), gen(aca_base)
recode healthreformbill_2016 (2=.5) (3=0) (8=.), gen(aca_16)

recode govt_reg_baseline (1=0) (2=.5) (3=1) (4/9=.), gen(reg_base)
recode govt_reg_2016 (1=0) (2=.5) (3=1) (4/9=.), gen(reg_16)

recode gaymar2_base (2=0) (3/9=.), gen(marriage_base)
recode gaymar_2016 (2=0) (3/9=.), gen(marriage_16)

recode immi_naturalize_baseline (2=0) (3/9=.), gen(immig_1)
recode immi_makedifficult_baseline (2=.75) (3=.5) (4=.25) (5=0) (6/9=.), gen(immig_2)
recode immi_contribution_baseline (2=.5) (3=0) (4/9=.), gen(immig_3)
gen immig_base = immig_1+immig_2+immig_3
replace immig_base = immig_base/3

drop immig_1
drop immig_2
drop immig_3

recode immi_naturalize_2016 (2=0) (3/9=.), gen(immig_1)
recode immi_makedifficult_2016 (2=.75) (3=.5) (4=.25) (5=0) (6/9=.), gen(immig_2)
recode immi_contribution_2016 (2=.5) (3=0) (4/9=.), gen(immig_3)
gen immig_16 = immig_1+immig_2+immig_3
replace immig_16 = immig_16/3

recode deathpenalty_baseline (1=0) (2=1) (3/9=.), gen(deathpen_base)
recode deathpen_2016 (1=0) (2=1) (3/9=.), gen(deathpen_16)

recode tradepolicy_base (2=0) (3/9=.), gen(trade_base)
recode tradepolicy_2016 (2=0) (3/9=.), gen(trade_16)


*Create macro with all additional issues:
local laggedpolicies = "aca_base reg_base marriage_base immig_base deathpen_base trade_base" 

*re-run original analysis including all lagged policy preference items [for Table S5]:

sureg (enviro_16 enviro_11 gw_11 `laggedpolicies' `controls') (gw_16 gw_11 enviro_11 `laggedpolicies' `controls') if pid7_baseline<8 [aw=weight_2016], corr

matrix foo = corr(e(Sigma))
local corr = foo[2,1]
estadd scalar corr_resid=  `corr'

estadd scalar chi =  `e(chi2_bp)'
matrix mymat = foo * foo
local tsig = (trace(mymat) - `e(k_eq)')*`e(N)' / 2
estadd scalar p = chiprob(1,`tsig')

lincom [enviro_16]gw_11 - [gw_16]enviro_11
estadd scalar betadiff = `r(estimate)'
estadd scalar betadiffse = `r(se)'

estimates store allpoliciesvsg

*Produce Table S5:

estout allpoliciescces allpoliciesvsg using TableS5.tab, cells(b(star fmt(%9.2f)) se(par([ ]))) stats(N r2 corr_resid chi p betadiff betadiffse, fmt(%9.2fc)) collabels(none) starlevels(* 0.05)  style(tab) keep(climate_10 envjobs_10 gw_11 enviro_11 iraq_10 natecon_10 abortion_10 immigration_10 marriage_10 gun_10 aca_base reg_base marriage_base immig_base deathpen_base trade_base) order(envjobs_10 climate_10 enviro_11 gw_11 iraq_10 natecon_10 abortion_10 immigration_10 marriage_10 gun_10 aca_base reg_base marriage_base immig_base deathpen_base trade_base) unstack replace


*run repeated tests with placebo predictors:

*tag complete cases again:
svyset [pw=weight_2016]
capture drop c
svy: reg enviro_16 enviro_11 gw_11 gw_16 `controls' if pid7_baseline<8
generate c = e(sample)

capture drop placebo_tminus1
capture drop gw_base
gen gw_base = gw_11
foreach predictor in gw aca reg marriage immig deathpen trade {
	capture drop placebo_tminus1
	gen placebo_tminus1 = `predictor'_base
	svy: reg enviro_16 enviro_11 placebo_tminus1 `controls' if c==1
	estimates store `predictor'
	}

*VSG Placebo Tests [Table S4]:

estout gw aca reg immig trade marriage deathpen using TableS4.tab, cells(b(star fmt(%9.2f)) se(par([ ]))) stats(N r2, fmt(%9.2gc)) collabels(none) starlevels(* 0.05)  style(tab) keep(placebo_tminus1 enviro_11) replace



